<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.green{
				background: #008000;
			}
		</style>
		<script src="./vue.js" ></script>
	</head>
	<body>
		<div id="app">
			<ul>
				<li v-for="(item,index) of es ":key="index" @click="green(index)" :class="{green:index===number}">
					{{index+1}}-{{item.name}}-{{item.salary}}
				</li>
			</ul>
			<ul>
				<li v-for="(value,key,index) in person">
					{{key}}-{{value}}
				</li>
			</ul>
		</div>
		<script type="text/javascript">
			var vm = new Vue({
				el:"#app",
				data:{
					es:[
						// 记得加引号哟
						{name:"liming",salary:15000},
						{name:"zhang",salary:10000}
					],
					person:{
						name:"liming",
						salary:15000
					},
					
					number:0
				},
				methods:{
					green(index){
						return this.number=index
					}
				}
			})
		</script>
	</body>
</html>
